package org.zdc.pivot.wtk.skin;
import nme.text.Font;
import org.zdc.pivot.wtk.Color;
import org.zdc.pivot.wtk.Component;
import org.zdc.pivot.wtk.HorizontalAlignment;
import org.zdc.pivot.wtk.Insets;
import org.zdc.pivot.wtk.Label;
import org.zdc.pivot.wtk.listener.ILabelListener;
import org.zdc.pivot.wtk.TextDecoration;
import org.zdc.pivot.wtk.Theme;
import org.zdc.pivot.wtk.VerticalAlignment;

class LabelSkin extends ComponentSkin,
				implements ILabelListener
{
	private var font:Font;
	private var color:Int;
	private var disabledColor:Int;
	private var backgroundColor:Int;
	private var textDecoration:TextDecoration;
	private var horizontalAlignment:HorizontalAlignment;
	private var verticalAlignment:VerticalAlignment;
	private var padding:Insets;
	private var wrapText:Bool;
	
	private var textHeight:Float;
	
	public function new() 
	{
		super();
		
		var theme:Theme = Theme.getTheme();
		font = theme.getFont();
		color = Color.BLACK; 
		disabledColor = Color.DARK_GRAY;
		backgroundColor = null;
		textDecoration = null;
		textHeight = 0;
		horizontalAlignment = HorizontalAlignment.LEFT;
		verticalAlignment = VerticalAlignment.TOP;
		padding = Insets.NONE;
		wrapText = false;
	}
	
	override public function install(c:Component):Void {
		super.install(c);
		
		var label:Label = untyped getComponent(); 
		label.getLabelListeners().add(this);
	}
	
	override public function getPreferredWidth(height:Float):Float 
	{
		var label:Label = untyped getComponent(); 
		var text:String = label.getText();
		var preferredWidth:Float;
		if (text != null &&
			text.length > 0) {
			preferredWidth = 
		}
	}
	
	public function textChanged(label:Label, previousText:String):Void {
		
	}
}